#pragma once
#include "ZuiLib.h"
#include "LRefObject.h"

namespace ZuiLib {

class LTextEdit :public LRefObject<ZTextEdit>
{
public:
	int getTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetTextColor());
	}

	int setTextColor(LuaFuncState& L)
	{
		pThis->SetTextColor(toColor(L.arg(0)));
		return 0;
	}

	int getFontName(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetFontName());
	}

	int setFontName(LuaFuncState& L)
	{
		pThis->SetFontName(L.arg(0).toString());
		return 0;
	}

	int getTextPadding(LuaFuncState& L)
	{
		return L.lreturn(toLua(&L, pThis->GetTextPadding()));
	}

	int setTextPadding(LuaFuncState& L)
	{
		pThis->SetTextPadding(toRect(L.arg(0)));
		return 0;
	}

	int getLineCount(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetLineCount());
	}

	int setLinePadding(LuaFuncState& L)
	{
		pThis->SetLinePadding(L.arg(0).toInt());
		return 0;
	}

	int copy(LuaFuncState& L)
	{
		pThis->Copy();
		return 0;
	}

	int cut(LuaFuncState& L)
	{
		pThis->Cut();
		return 0;
	}

	int paste(LuaFuncState& L)
	{
		pThis->Paste();
		return 0;
	}

	int selAll(LuaFuncState& L)
	{
		pThis->SelAll();
		return 0;
	}

	int selNone(LuaFuncState& L)
	{
		pThis->SelNone();
		return 0;
	}


	int appendText(LuaFuncState& L)
	{
		pThis->AppendText(L.arg(0).toString());
		return 0;
	}

	BEGIN_MAP_FUNC(LTextEdit)
	DECLARE_FUNC(getTextColor),
	DECLARE_FUNC(setTextColor),
	DECLARE_FUNC(getFontName),
	DECLARE_FUNC(setFontName),
	DECLARE_FUNC(getTextPadding),
	DECLARE_FUNC(setTextPadding),
	DECLARE_FUNC(getLineCount),
	DECLARE_FUNC(setLinePadding),
	DECLARE_FUNC(copy),
	DECLARE_FUNC(cut),
	DECLARE_FUNC(paste),
	DECLARE_FUNC(selAll),
	DECLARE_FUNC(selNone),
	DECLARE_FUNC(appendText),
	END_MAP_FUNC
};

}//namespace
